package com.tac.controller;

import com.tac.common.result.Result;
import com.tac.pojo.MyTarget;
import com.tac.service.MyTargetService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/myTarget")
@CrossOrigin
@Api(tags = "我的标的")
@RestController
public class MyTargetController {

    @Autowired
    private MyTargetService myTargetService;


    @GetMapping("/getList")
    @ApiOperation("我的标的查看")
    public Result<List<MyTarget>> getList(){
        return myTargetService.getList();
    }
   @PutMapping("/update")
   @ApiOperation("我的标的修改")
    public Result update(@RequestBody  MyTarget myTarget){
        return myTargetService.update(myTarget);
    }

    @DeleteMapping("/remove")
    @ApiOperation("我的标的删除")
    public Result remove(@RequestBody  List<Integer> ids){
        return myTargetService.remove(ids);
    }

    @PostMapping("/save")
    @ApiOperation("我的标的添加")
    public Result save(@RequestBody MyTarget myTarget){
        return myTargetService.save(myTarget);
    }
}
